<?php
namespace app\common\validate;
use think\Validate;

class User extends Validate
{
    protected $rule = [
        ['user_id'  ,'number|require|gt:0','参数错误|参数错误|参数错误'],
        ['username'  ,'alphaDash|require','请输入正确的账号|请输入正确的账号'],
        ['nickname'  ,'require','请输入昵称'],
        ['qq'  ,'integer|require|gt:0','请输入正确的QQ|请输入正确的QQ|请输入正确的QQ'],
        ['sex'  ,'integer|require|gt:0','性别参数错误|性别参数错误|性别参数错误'],
        ['email'  ,'require|email','请填写电子邮箱|请填写正确电子邮箱'],
        ['birthday','date','生日必须日期格式'],
        ['password'  ,'require','请输入密码'],
        ['old_password'  ,'require','请输入旧密码'],
        ['bankname'  ,'require','请填写开户行'],
        ['card','require','请填写银行卡号'],
        ['name'  ,'require','请输入姓名'],
        ['pay_password'  ,'require','请输入正确的支付密码|请输入正确的支付密码|请输入正确的支付密码'],
        ['code'  ,'require','请填写正确的验证码'],
        ['type'  ,'integer|require|gt:0','状态参数出错|状态参数出错|状态参数出错'],
        ['agent_id'  ,'integer','代理商id参数出错'],
        ['top_agent_id'  ,'integer','总代理商id参数出错'],
        ['referee_id'  ,'integer','推荐人id参数出错'],
        ['mobile','number|require','请输入正确的手机号|请输入正确的手机号'],
        ['shopid','number|require|gt:0','参数错误|参数错误|参数错误'],
        ['money','number|require|gt:0','参数错误|参数错误|参数错误'],
        ['rid'  ,'number|require|gt:0','等级ID参数错误|等级ID参数错误|等级ID参数错误'],

    ];

    protected $scene = [
        'login'        => ['username','password'],
        'logincode'    => ['mobile','code'],
        'mobile'       => ['mobile'],
        'uid'          => ['user_id'],
        'type'         => ['type'],
        'register'     => ['mobile','password','agent_id','referee_id'],
        'pay'          => ['user_id','shopid','money','type'],
        'recharge'     => ['user_id','money'],
        'update_pay_password'          => ['user_id','pay_password'],
        'update_password'          => ['user_id','password','old_password'],
        'update_rid' =>['user_id','rid'],
        'update' =>['nickname','qq','sex','email','birthday'],
        'withdraw'     => ['pay_password','money','type'],
        'card'     => ['card','bankname','name'],
        'name'    => ['name'],
    ];
}